<div class="container-fluid suredy-form" style="padding-top: 0">
	<div class="row">	
		<form name="form" id="form">	
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">区域名称</div>
					<input type="text" class="form-control" id="name" name="name" placeholder="区域名称" />
					<div class="input-group-addon"> 必填 </div>
				</div>
			</div>	
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">区域代码</div>
					<input type="text" class="form-control" id="code" name="code"  placeholder="区域代码"/>
				</div>
			</div>			
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">经度数据</div>
					<input type="text" class="form-control" id="longitude" name="longitude"  placeholder="经度"/>
				</div>
			</div>	
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">纬度数据</div>
					<input type="text" class="form-control" id="latitude" name="latitude"  placeholder="纬度"/>
				</div>
			</div>
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">区域描述</div>
					<textarea class="form-control" name="description" id="description" placeholder="区域描述" rows="3"></textarea>
				</div>
			</div>							
		</form>
		<div class="text-center">
			<div class="btn btn-info" id="btn-save" >
				<i class="icon-save"></i> 保存
			</div>
		</div>																										
	</div>
</div>
<script type="text/javascript">
	$(document).ready(function() {				
		$('#btn-save').click(function() {
			var name = $('#name').val();
			if (name == '') {
				alert('请填写区域名称！');
				return;
			}
		


			$.ajax({
				url : 'app/area/create-save',
				dataType : 'json',
				type : 'POST',
				data : $('#form').serialize(),
				success : function(success) {
					if (!success) {
						alert('新建区域信息失败！');
					} else if (!success.success) {
						alert('新建区域信息失败！\n\n' + success.msg);
					} else {
						alert('新建区域信息成功！');
						$.suredy.loadContent('app/area/list');
						$.suredy.closeModal();
					}
				},
				error : function(a, b, c) {
					alert('服务器错误! ' + b);
				}
			});
		});	
	});
</script>	
